const fs = require("fs");
//写入
fs.writeFile("./test3.txt","测试简单写入",{
    encoding:"utf-8",mode:0o666,flag:"w"
},err=>{
    if(!err) console.log("成功");
    else console.log(err);
})
//仓库 > cmd > node .\6.简单写入.js
//test3.txt里才会出现写入的内容

//读取
fs.readFile("./test3.txt",{flag:"r"},(err,data)=>{
    if(!err){
        console.log(data);
        console.log(data.toString());
        console.log("成功");
    } 
    else console.log(err);
})